SlideShare a Scribd company logo
Class No.17  Data Structures http://ecomputernotes.com
Reference Variables ,[object Object],[object Object],http://ecomputernotes.com
Reference Variables ,[object Object],[object Object],[object Object],http://ecomputernotes.com
Reference Variables ,[object Object],[object Object],http://ecomputernotes.com
Reference Variables ,[object Object],[object Object],http://ecomputernotes.com
Reference Variables // example 1 int intMinus1( int oldVal) { oldVal = oldVal – 1; return oldVal; } http://ecomputernotes.com
Reference Variables // example 2 int intMinus2( int* oldVal) { *oldVal = *oldVal – 2; return *oldVal; } http://ecomputernotes.com
Reference Variables // example 3 int intMinus3( int& oldVal) { oldVal = oldVal – 3; return oldVal; } http://ecomputernotes.com
Reference Variables The caller function: calling  intMinus1 void caller() { int myInt = 31; int retVal; retVal = intMinus1( myInt ); cout << myInt << retVal; } http://ecomputernotes.com
Memory Organization Code Static data Stack Heap Process 1 (browser) Process 3 (word) Process 4 (ourtest.exe) Windows OS Process 2 (dev-c++) http://ecomputernotes.com
Reference Variables ,[object Object],Parameters(caller) Local variables(caller) Return address(caller) Parameters(intMinus1) Local variables(intMinus1) Return address(intMinus1) sp Stack grows downwards http://ecomputernotes.com
Reference Variables Call stack layout when intMinus1 is called: 1052 1060 1068 1056 31 1072 ? caller’s other stuff   myInt retVal oldVal 31 calling function “caller” called function “intMinus1” stack grows downwards   sp
Reference Variables ,[object Object],[object Object],[object Object],http://ecomputernotes.com
Reference Variables ,[object Object],[object Object],[object Object],http://ecomputernotes.com
Reference Variables Call stack layout after subtraction in intMinus1: 1052 1060 1068 1056 31 1072 ? caller’s other stuff   myInt retVal oldVal 31 calling function “caller” called function “intMinus1” stack grows downwards   sp 30
Reference Variables Call stack layout after return from intMinus1: 1068 31 1072 30 caller’s other stuff   myInt retVal calling function “caller” stack grows downwards   sp
Reference Variables ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],http://ecomputernotes.com
Reference Variables ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],http://ecomputernotes.com
Reference Variables Call stack layout when intMinus2 is called: 1052 1060 1068 1056 31 1072 ? caller’s other stuff   myInt retVal oldVal 1072 calling function “caller” called function “intMinus2” stack grows downwards   sp
Reference Variables Call stack layout after  *oldVal = *oldVal – 2; 1052 1060 1068 1056 31 1072 ? caller’s other stuff   myInt retVal oldVal 1072 calling function “caller” called function “intMinus2” stack grows downwards   sp 29
Reference Variables Call stack layout after return from  intMinus2. 1068 31 1072 29 caller’s other stuff   myInt retVal calling function “caller” stack grows downwards   sp 29
Reference Variables ,[object Object],[object Object],[object Object],http://ecomputernotes.com
Reference Variables ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],http://ecomputernotes.com
Reference Variables ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],http://ecomputernotes.com
Reference Variables ,[object Object],[object Object],[object Object],[object Object],http://ecomputernotes.com
Reference Variables Call stack layout when intMinus3 is called: 1052 1060 1068 1056 31 1072 ? caller’s other stuff   myInt retVal oldVal calling function “caller” called function “intMinus3” stack grows downwards   sp
Reference Variables Call stack layout when intMinus3 is called: 1052 1060 1068 1056 31 1072 ? caller’s other stuff   myInt retVal oldVal calling function “caller” called function “intMinus3” stack grows downwards   sp
Reference Variables Call stack layout after oldVal = oldVal - 3: 1052 1060 1068 1056 31 1072 ? caller’s other stuff   myInt retVal oldVal calling function “caller” called function “intMinus3” stack grows downwards   sp 28
Reference Variables Call stack layout after return from intMinus3: 1068 31 1072 28 caller’s other stuff   myInt retVal calling function “caller” stack grows downwards   sp 28
Reference Variables ,[object Object],[object Object],[object Object],http://ecomputernotes.com

More Related Content

What's hot

Operating System Assignment Help
Operating System Assignment HelpOperating System Assignment Help
Operating System Assignment Help
Programming Homework Help
 
Storage classes arrays & functions in C Language
Storage classes arrays & functions in C LanguageStorage classes arrays & functions in C Language
Storage classes arrays & functions in C Language
Jenish Bhavsar
 
Python Modules, Packages and Libraries
Python Modules, Packages and LibrariesPython Modules, Packages and Libraries
Python Modules, Packages and Libraries
Venugopalavarma Raja
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
Marian Marinov
 
Python
PythonPython
Pointer to function 2
Pointer to function 2Pointer to function 2
Pointer to function 2
Abu Bakr Ramadan
 
Lecture 5
Lecture 5Lecture 5
Lecture 5
Mohammed Saleh
 
Maharishi University of Management (MSc Computer Science test questions)
Maharishi University of Management (MSc Computer Science test questions)Maharishi University of Management (MSc Computer Science test questions)
Maharishi University of Management (MSc Computer Science test questions)
Dharma Kshetri
 
e computer notes - Reference variables
e computer notes - Reference variablese computer notes - Reference variables
e computer notes - Reference variables
ecomputernotes
 
Pointer basics
Pointer basicsPointer basics
Pointer basics
Mohammed Sikander
 
Prsentation on functions
Prsentation on functionsPrsentation on functions
Prsentation on functions
Alisha Korpal
 
Pointer to function 1
Pointer to function 1Pointer to function 1
Pointer to function 1
Abu Bakr Ramadan
 
C++ lecture 03
C++   lecture 03C++   lecture 03
C++ lecture 03
HNDE Labuduwa Galle
 
Lecture 11 - Functions
Lecture 11 - FunctionsLecture 11 - Functions
Lecture 11 - Functions
Md. Imran Hossain Showrov
 
Function Pointer
Function PointerFunction Pointer
Function Pointer
Dr-Dipali Meher
 
c++ pointers by Amir Hamza Khan (SZABISTIAN)
c++ pointers by Amir Hamza Khan (SZABISTIAN)c++ pointers by Amir Hamza Khan (SZABISTIAN)
c++ pointers by Amir Hamza Khan (SZABISTIAN)
Ameer Hamxa
 
Pointers in C
Pointers in CPointers in C
Pointers in C
Prabhu Govind
 
Learn c++ (functions) with nauman ur rehman
Learn  c++ (functions) with nauman ur rehmanLearn  c++ (functions) with nauman ur rehman
Learn c++ (functions) with nauman ur rehman
Nauman Rehman
 
computer notes - Stack
computer notes - Stackcomputer notes - Stack
computer notes - Stack
ecomputernotes
 

What's hot (19)

Operating System Assignment Help
Operating System Assignment HelpOperating System Assignment Help
Operating System Assignment Help
 
Storage classes arrays & functions in C Language
Storage classes arrays & functions in C LanguageStorage classes arrays & functions in C Language
Storage classes arrays & functions in C Language
 
Python Modules, Packages and Libraries
Python Modules, Packages and LibrariesPython Modules, Packages and Libraries
Python Modules, Packages and Libraries
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Python
PythonPython
Python
 
Pointer to function 2
Pointer to function 2Pointer to function 2
Pointer to function 2
 
Lecture 5
Lecture 5Lecture 5
Lecture 5
 
Maharishi University of Management (MSc Computer Science test questions)
Maharishi University of Management (MSc Computer Science test questions)Maharishi University of Management (MSc Computer Science test questions)
Maharishi University of Management (MSc Computer Science test questions)
 
e computer notes - Reference variables
e computer notes - Reference variablese computer notes - Reference variables
e computer notes - Reference variables
 
Pointer basics
Pointer basicsPointer basics
Pointer basics
 
Prsentation on functions
Prsentation on functionsPrsentation on functions
Prsentation on functions
 
Pointer to function 1
Pointer to function 1Pointer to function 1
Pointer to function 1
 
C++ lecture 03
C++   lecture 03C++   lecture 03
C++ lecture 03
 
Lecture 11 - Functions
Lecture 11 - FunctionsLecture 11 - Functions
Lecture 11 - Functions
 
Function Pointer
Function PointerFunction Pointer
Function Pointer
 
c++ pointers by Amir Hamza Khan (SZABISTIAN)
c++ pointers by Amir Hamza Khan (SZABISTIAN)c++ pointers by Amir Hamza Khan (SZABISTIAN)
c++ pointers by Amir Hamza Khan (SZABISTIAN)
 
Pointers in C
Pointers in CPointers in C
Pointers in C
 
Learn c++ (functions) with nauman ur rehman
Learn  c++ (functions) with nauman ur rehmanLearn  c++ (functions) with nauman ur rehman
Learn c++ (functions) with nauman ur rehman
 
computer notes - Stack
computer notes - Stackcomputer notes - Stack
computer notes - Stack
 

Viewers also liked

computer notes - Data Structures - 26
computer notes - Data Structures - 26computer notes - Data Structures - 26
computer notes - Data Structures - 26
ecomputernotes
 
computer notes - Data Structures - 31
computer notes - Data Structures - 31computer notes - Data Structures - 31
computer notes - Data Structures - 31
ecomputernotes
 
computer notes - Data Structures - 7
computer notes - Data Structures - 7computer notes - Data Structures - 7
computer notes - Data Structures - 7
ecomputernotes
 
computer notes - Data Structures - 5
computer notes - Data Structures - 5computer notes - Data Structures - 5
computer notes - Data Structures - 5
ecomputernotes
 
computer notes - Data Structures - 25
computer notes - Data Structures - 25computer notes - Data Structures - 25
computer notes - Data Structures - 25
ecomputernotes
 
computer notes - Data Structures - 2
computer notes - Data Structures - 2computer notes - Data Structures - 2
computer notes - Data Structures - 2
ecomputernotes
 
computer notes - Data Structures - 18
computer notes - Data Structures - 18computer notes - Data Structures - 18
computer notes - Data Structures - 18
ecomputernotes
 
computer notes - Data Structures - 1
computer notes - Data Structures - 1computer notes - Data Structures - 1
computer notes - Data Structures - 1
ecomputernotes
 
computer notes - Data Structures - 37
computer notes - Data Structures - 37computer notes - Data Structures - 37
computer notes - Data Structures - 37
ecomputernotes
 
computer notes - Data Structures - 36
computer notes - Data Structures - 36computer notes - Data Structures - 36
computer notes - Data Structures - 36
ecomputernotes
 
computer notes - Data Structures - 32
computer notes - Data Structures - 32computer notes - Data Structures - 32
computer notes - Data Structures - 32
ecomputernotes
 
computer notes - Data Structures - 8
computer notes - Data Structures - 8computer notes - Data Structures - 8
computer notes - Data Structures - 8
ecomputernotes
 
computer notes - Data Structures - 11
computer notes - Data Structures - 11computer notes - Data Structures - 11
computer notes - Data Structures - 11
ecomputernotes
 
computer notes - Data Structures - 21
computer notes - Data Structures - 21computer notes - Data Structures - 21
computer notes - Data Structures - 21
ecomputernotes
 
computer notes - Data Structures - 6
computer notes - Data Structures - 6computer notes - Data Structures - 6
computer notes - Data Structures - 6
ecomputernotes
 
computer notes - Data Structures - 27
computer notes - Data Structures - 27computer notes - Data Structures - 27
computer notes - Data Structures - 27
ecomputernotes
 
computer notes - Data Structures - 12
computer notes - Data Structures - 12computer notes - Data Structures - 12
computer notes - Data Structures - 12
ecomputernotes
 
computer notes - Data Structures - 39
computer notes - Data Structures - 39computer notes - Data Structures - 39
computer notes - Data Structures - 39
ecomputernotes
 
computer notes - Data Structures - 33
computer notes - Data Structures - 33computer notes - Data Structures - 33
computer notes - Data Structures - 33
ecomputernotes
 
computer notes - Data Structures - 19
computer notes - Data Structures - 19computer notes - Data Structures - 19
computer notes - Data Structures - 19
ecomputernotes
 

Viewers also liked (20)

computer notes - Data Structures - 26
computer notes - Data Structures - 26computer notes - Data Structures - 26
computer notes - Data Structures - 26
 
computer notes - Data Structures - 31
computer notes - Data Structures - 31computer notes - Data Structures - 31
computer notes - Data Structures - 31
 
computer notes - Data Structures - 7
computer notes - Data Structures - 7computer notes - Data Structures - 7
computer notes - Data Structures - 7
 
computer notes - Data Structures - 5
computer notes - Data Structures - 5computer notes - Data Structures - 5
computer notes - Data Structures - 5
 
computer notes - Data Structures - 25
computer notes - Data Structures - 25computer notes - Data Structures - 25
computer notes - Data Structures - 25
 
computer notes - Data Structures - 2
computer notes - Data Structures - 2computer notes - Data Structures - 2
computer notes - Data Structures - 2
 
computer notes - Data Structures - 18
computer notes - Data Structures - 18computer notes - Data Structures - 18
computer notes - Data Structures - 18
 
computer notes - Data Structures - 1
computer notes - Data Structures - 1computer notes - Data Structures - 1
computer notes - Data Structures - 1
 
computer notes - Data Structures - 37
computer notes - Data Structures - 37computer notes - Data Structures - 37
computer notes - Data Structures - 37
 
computer notes - Data Structures - 36
computer notes - Data Structures - 36computer notes - Data Structures - 36
computer notes - Data Structures - 36
 
computer notes - Data Structures - 32
computer notes - Data Structures - 32computer notes - Data Structures - 32
computer notes - Data Structures - 32
 
computer notes - Data Structures - 8
computer notes - Data Structures - 8computer notes - Data Structures - 8
computer notes - Data Structures - 8
 
computer notes - Data Structures - 11
computer notes - Data Structures - 11computer notes - Data Structures - 11
computer notes - Data Structures - 11
 
computer notes - Data Structures - 21
computer notes - Data Structures - 21computer notes - Data Structures - 21
computer notes - Data Structures - 21
 
computer notes - Data Structures - 6
computer notes - Data Structures - 6computer notes - Data Structures - 6
computer notes - Data Structures - 6
 
computer notes - Data Structures - 27
computer notes - Data Structures - 27computer notes - Data Structures - 27
computer notes - Data Structures - 27
 
computer notes - Data Structures - 12
computer notes - Data Structures - 12computer notes - Data Structures - 12
computer notes - Data Structures - 12
 
computer notes - Data Structures - 39
computer notes - Data Structures - 39computer notes - Data Structures - 39
computer notes - Data Structures - 39
 
computer notes - Data Structures - 33
computer notes - Data Structures - 33computer notes - Data Structures - 33
computer notes - Data Structures - 33
 
computer notes - Data Structures - 19
computer notes - Data Structures - 19computer notes - Data Structures - 19
computer notes - Data Structures - 19
 

Similar to computer notes - Data Structures - 17

computer notes - Reference variables
computer notes -  Reference variablescomputer notes -  Reference variables
computer notes - Reference variables
ecomputernotes
 
Lecture#7 Call by value and reference in c++
Lecture#7 Call by value and reference in c++Lecture#7 Call by value and reference in c++
Lecture#7 Call by value and reference in c++
NUST Stuff
 
Function C++
Function C++ Function C++
Function C++
Shahzad Afridi
 
functions
functionsfunctions
functions
Makwana Bhavesh
 
Chapter 1. Functions in C++.pdf
Chapter 1.  Functions in C++.pdfChapter 1.  Functions in C++.pdf
Chapter 1. Functions in C++.pdf
TeshaleSiyum
 
Chapter_1.__Functions_in_C++[1].pdf
Chapter_1.__Functions_in_C++[1].pdfChapter_1.__Functions_in_C++[1].pdf
Chapter_1.__Functions_in_C++[1].pdf
TeshaleSiyum
 
Unit-III.pptx
Unit-III.pptxUnit-III.pptx
Unit-III.pptx
Mehul Desai
 
11 functions
11 functions11 functions
11 functions
Rohit Shrivastava
 
Preprocessor directives
Preprocessor directivesPreprocessor directives
Preprocessor directives
Vikash Dhal
 
Chap 9(functions)
Chap 9(functions)Chap 9(functions)
Chapter 4
Chapter 4Chapter 4
Chapter 4
temkin abdlkader
 
Programming in C sesion 2
Programming in C sesion 2Programming in C sesion 2
Programming in C sesion 2
Prerna Sharma
 
CHAPTER THREE FUNCTION.pptx
CHAPTER THREE FUNCTION.pptxCHAPTER THREE FUNCTION.pptx
CHAPTER THREE FUNCTION.pptx
GebruGetachew2
 
Fundamental of programming Fundamental of programming
Fundamental of programming Fundamental of programmingFundamental of programming Fundamental of programming
Fundamental of programming Fundamental of programming
LidetAdmassu
 
2.overview of c++ ________lecture2
2.overview of c++  ________lecture22.overview of c++  ________lecture2
2.overview of c++ ________lecture2
Warui Maina
 
MTPLs
MTPLsMTPLs
MTPLs
miso_uam
 
1. DSA - Introduction.pptx
1. DSA - Introduction.pptx1. DSA - Introduction.pptx
1. DSA - Introduction.pptx
hara69
 
how to reuse code
how to reuse codehow to reuse code
how to reuse code
jleed1
 
Functions in C++.pdf
Functions in C++.pdfFunctions in C++.pdf
Functions in C++.pdf
LadallaRajKumar
 
functions- best.pdf
functions- best.pdffunctions- best.pdf
functions- best.pdf
MikialeTesfamariam
 

Similar to computer notes - Data Structures - 17 (20)

computer notes - Reference variables
computer notes -  Reference variablescomputer notes -  Reference variables
computer notes - Reference variables
 
Lecture#7 Call by value and reference in c++
Lecture#7 Call by value and reference in c++Lecture#7 Call by value and reference in c++
Lecture#7 Call by value and reference in c++
 
Function C++
Function C++ Function C++
Function C++
 
functions
functionsfunctions
functions
 
Chapter 1. Functions in C++.pdf
Chapter 1.  Functions in C++.pdfChapter 1.  Functions in C++.pdf
Chapter 1. Functions in C++.pdf
 
Chapter_1.__Functions_in_C++[1].pdf
Chapter_1.__Functions_in_C++[1].pdfChapter_1.__Functions_in_C++[1].pdf
Chapter_1.__Functions_in_C++[1].pdf
 
Unit-III.pptx
Unit-III.pptxUnit-III.pptx
Unit-III.pptx
 
11 functions
11 functions11 functions
11 functions
 
Preprocessor directives
Preprocessor directivesPreprocessor directives
Preprocessor directives
 
Chap 9(functions)
Chap 9(functions)Chap 9(functions)
Chap 9(functions)
 
Chapter 4
Chapter 4Chapter 4
Chapter 4
 
Programming in C sesion 2
Programming in C sesion 2Programming in C sesion 2
Programming in C sesion 2
 
CHAPTER THREE FUNCTION.pptx
CHAPTER THREE FUNCTION.pptxCHAPTER THREE FUNCTION.pptx
CHAPTER THREE FUNCTION.pptx
 
Fundamental of programming Fundamental of programming
Fundamental of programming Fundamental of programmingFundamental of programming Fundamental of programming
Fundamental of programming Fundamental of programming
 
2.overview of c++ ________lecture2
2.overview of c++  ________lecture22.overview of c++  ________lecture2
2.overview of c++ ________lecture2
 
MTPLs
MTPLsMTPLs
MTPLs
 
1. DSA - Introduction.pptx
1. DSA - Introduction.pptx1. DSA - Introduction.pptx
1. DSA - Introduction.pptx
 
how to reuse code
how to reuse codehow to reuse code
how to reuse code
 
Functions in C++.pdf
Functions in C++.pdfFunctions in C++.pdf
Functions in C++.pdf
 
functions- best.pdf
functions- best.pdffunctions- best.pdf
functions- best.pdf
 

More from ecomputernotes

computer notes - Data Structures - 30
computer notes - Data Structures - 30computer notes - Data Structures - 30
computer notes - Data Structures - 30
ecomputernotes
 
computer notes - Data Structures - 20
computer notes - Data Structures - 20computer notes - Data Structures - 20
computer notes - Data Structures - 20
ecomputernotes
 
computer notes - Data Structures - 15
computer notes - Data Structures - 15computer notes - Data Structures - 15
computer notes - Data Structures - 15
ecomputernotes
 
Computer notes - Including Constraints
Computer notes - Including ConstraintsComputer notes - Including Constraints
Computer notes - Including Constraintsecomputernotes
 
Computer notes - Date time Functions
Computer notes - Date time FunctionsComputer notes - Date time Functions
Computer notes - Date time Functionsecomputernotes
 
Computer notes - Subqueries
Computer notes - SubqueriesComputer notes - Subqueries
Computer notes - Subqueriesecomputernotes
 
Computer notes - Other Database Objects
Computer notes - Other Database ObjectsComputer notes - Other Database Objects
Computer notes - Other Database Objectsecomputernotes
 
computer notes - Data Structures - 28
computer notes - Data Structures - 28computer notes - Data Structures - 28
computer notes - Data Structures - 28
ecomputernotes
 
computer notes - Data Structures - 4
computer notes - Data Structures - 4computer notes - Data Structures - 4
computer notes - Data Structures - 4
ecomputernotes
 
computer notes - Data Structures - 13
computer notes - Data Structures - 13computer notes - Data Structures - 13
computer notes - Data Structures - 13
ecomputernotes
 
Computer notes - Advanced Subqueries
Computer notes -   Advanced SubqueriesComputer notes -   Advanced Subqueries
Computer notes - Advanced Subqueriesecomputernotes
 
Computer notes - Aggregating Data Using Group Functions
Computer notes - Aggregating Data Using Group FunctionsComputer notes - Aggregating Data Using Group Functions
Computer notes - Aggregating Data Using Group Functionsecomputernotes
 
computer notes - Data Structures - 16
computer notes - Data Structures - 16computer notes - Data Structures - 16
computer notes - Data Structures - 16
ecomputernotes
 
computer notes - Data Structures - 22
computer notes - Data Structures - 22computer notes - Data Structures - 22
computer notes - Data Structures - 22
ecomputernotes
 
computer notes - Data Structures - 35
computer notes - Data Structures - 35computer notes - Data Structures - 35
computer notes - Data Structures - 35
ecomputernotes
 
Computer notes - Enhancements to the GROUP BY Clause
Computer notes - Enhancements to the GROUP BY ClauseComputer notes - Enhancements to the GROUP BY Clause
Computer notes - Enhancements to the GROUP BY Clauseecomputernotes
 
Computer notes - Manipulating Data
Computer notes - Manipulating DataComputer notes - Manipulating Data
Computer notes - Manipulating Dataecomputernotes
 
Computer notes - Writing Basic SQL SELECT Statements
Computer notes - Writing Basic SQL SELECT StatementsComputer notes - Writing Basic SQL SELECT Statements
Computer notes - Writing Basic SQL SELECT Statementsecomputernotes
 
computer notes - Data Structures - 14
computer notes - Data Structures - 14computer notes - Data Structures - 14
computer notes - Data Structures - 14
ecomputernotes
 
computer notes - Data Structures - 10
computer notes - Data Structures - 10computer notes - Data Structures - 10
computer notes - Data Structures - 10
ecomputernotes
 

More from ecomputernotes (20)

computer notes - Data Structures - 30
computer notes - Data Structures - 30computer notes - Data Structures - 30
computer notes - Data Structures - 30
 
computer notes - Data Structures - 20
computer notes - Data Structures - 20computer notes - Data Structures - 20
computer notes - Data Structures - 20
 
computer notes - Data Structures - 15
computer notes - Data Structures - 15computer notes - Data Structures - 15
computer notes - Data Structures - 15
 
Computer notes - Including Constraints
Computer notes - Including ConstraintsComputer notes - Including Constraints
Computer notes - Including Constraints
 
Computer notes - Date time Functions
Computer notes - Date time FunctionsComputer notes - Date time Functions
Computer notes - Date time Functions
 
Computer notes - Subqueries
Computer notes - SubqueriesComputer notes - Subqueries
Computer notes - Subqueries
 
Computer notes - Other Database Objects
Computer notes - Other Database ObjectsComputer notes - Other Database Objects
Computer notes - Other Database Objects
 
computer notes - Data Structures - 28
computer notes - Data Structures - 28computer notes - Data Structures - 28
computer notes - Data Structures - 28
 
computer notes - Data Structures - 4
computer notes - Data Structures - 4computer notes - Data Structures - 4
computer notes - Data Structures - 4
 
computer notes - Data Structures - 13
computer notes - Data Structures - 13computer notes - Data Structures - 13
computer notes - Data Structures - 13
 
Computer notes - Advanced Subqueries
Computer notes -   Advanced SubqueriesComputer notes -   Advanced Subqueries
Computer notes - Advanced Subqueries
 
Computer notes - Aggregating Data Using Group Functions
Computer notes - Aggregating Data Using Group FunctionsComputer notes - Aggregating Data Using Group Functions
Computer notes - Aggregating Data Using Group Functions
 
computer notes - Data Structures - 16
computer notes - Data Structures - 16computer notes - Data Structures - 16
computer notes - Data Structures - 16
 
computer notes - Data Structures - 22
computer notes - Data Structures - 22computer notes - Data Structures - 22
computer notes - Data Structures - 22
 
computer notes - Data Structures - 35
computer notes - Data Structures - 35computer notes - Data Structures - 35
computer notes - Data Structures - 35
 
Computer notes - Enhancements to the GROUP BY Clause
Computer notes - Enhancements to the GROUP BY ClauseComputer notes - Enhancements to the GROUP BY Clause
Computer notes - Enhancements to the GROUP BY Clause
 
Computer notes - Manipulating Data
Computer notes - Manipulating DataComputer notes - Manipulating Data
Computer notes - Manipulating Data
 
Computer notes - Writing Basic SQL SELECT Statements
Computer notes - Writing Basic SQL SELECT StatementsComputer notes - Writing Basic SQL SELECT Statements
Computer notes - Writing Basic SQL SELECT Statements
 
computer notes - Data Structures - 14
computer notes - Data Structures - 14computer notes - Data Structures - 14
computer notes - Data Structures - 14
 
computer notes - Data Structures - 10
computer notes - Data Structures - 10computer notes - Data Structures - 10
computer notes - Data Structures - 10
 

Recently uploaded

PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Zilliz
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 

Recently uploaded (20)

PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 

computer notes - Data Structures - 17

  • 1. Class No.17 Data Structures http://ecomputernotes.com
  • 2.
  • 3.
  • 4.
  • 5.
  • 6. Reference Variables // example 1 int intMinus1( int oldVal) { oldVal = oldVal – 1; return oldVal; } http://ecomputernotes.com
  • 7. Reference Variables // example 2 int intMinus2( int* oldVal) { *oldVal = *oldVal – 2; return *oldVal; } http://ecomputernotes.com
  • 8. Reference Variables // example 3 int intMinus3( int& oldVal) { oldVal = oldVal – 3; return oldVal; } http://ecomputernotes.com
  • 9. Reference Variables The caller function: calling intMinus1 void caller() { int myInt = 31; int retVal; retVal = intMinus1( myInt ); cout << myInt << retVal; } http://ecomputernotes.com
  • 10. Memory Organization Code Static data Stack Heap Process 1 (browser) Process 3 (word) Process 4 (ourtest.exe) Windows OS Process 2 (dev-c++) http://ecomputernotes.com
  • 11.
  • 12. Reference Variables Call stack layout when intMinus1 is called: 1052 1060 1068 1056 31 1072 ? caller’s other stuff myInt retVal oldVal 31 calling function “caller” called function “intMinus1” stack grows downwards sp
  • 13.
  • 14.
  • 15. Reference Variables Call stack layout after subtraction in intMinus1: 1052 1060 1068 1056 31 1072 ? caller’s other stuff myInt retVal oldVal 31 calling function “caller” called function “intMinus1” stack grows downwards sp 30
  • 16. Reference Variables Call stack layout after return from intMinus1: 1068 31 1072 30 caller’s other stuff myInt retVal calling function “caller” stack grows downwards sp
  • 17.
  • 18.
  • 19. Reference Variables Call stack layout when intMinus2 is called: 1052 1060 1068 1056 31 1072 ? caller’s other stuff myInt retVal oldVal 1072 calling function “caller” called function “intMinus2” stack grows downwards sp
  • 20. Reference Variables Call stack layout after *oldVal = *oldVal – 2; 1052 1060 1068 1056 31 1072 ? caller’s other stuff myInt retVal oldVal 1072 calling function “caller” called function “intMinus2” stack grows downwards sp 29
  • 21. Reference Variables Call stack layout after return from intMinus2. 1068 31 1072 29 caller’s other stuff myInt retVal calling function “caller” stack grows downwards sp 29
  • 22.
  • 23.
  • 24.
  • 25.
  • 26. Reference Variables Call stack layout when intMinus3 is called: 1052 1060 1068 1056 31 1072 ? caller’s other stuff myInt retVal oldVal calling function “caller” called function “intMinus3” stack grows downwards sp
  • 27. Reference Variables Call stack layout when intMinus3 is called: 1052 1060 1068 1056 31 1072 ? caller’s other stuff myInt retVal oldVal calling function “caller” called function “intMinus3” stack grows downwards sp
  • 28. Reference Variables Call stack layout after oldVal = oldVal - 3: 1052 1060 1068 1056 31 1072 ? caller’s other stuff myInt retVal oldVal calling function “caller” called function “intMinus3” stack grows downwards sp 28
  • 29. Reference Variables Call stack layout after return from intMinus3: 1068 31 1072 28 caller’s other stuff myInt retVal calling function “caller” stack grows downwards sp 28
  • 30.

Editor's Notes

  1. Start of lecture 17
  2. The second goal is the “nuts and bolts” of the course. The third goal prepares a student for the future.
  3. The second goal is the “nuts and bolts” of the course. The third goal prepares a student for the future.
  4. The second goal is the “nuts and bolts” of the course. The third goal prepares a student for the future.
  5. The second goal is the “nuts and bolts” of the course. The third goal prepares a student for the future.
  6. The second goal is the “nuts and bolts” of the course. The third goal prepares a student for the future.
  7. End of lecture 2 The second goal is the “nuts and bolts” of the course. The third goal prepares a student for the future.
  8. The second goal is the “nuts and bolts” of the course. The third goal prepares a student for the future.
  9. The second goal is the “nuts and bolts” of the course. The third goal prepares a student for the future.
  10. The second goal is the “nuts and bolts” of the course. The third goal prepares a student for the future.
  11. End of Lecture 17